package com.ygxsk.carhome.response;

import android.os.Parcel;
import android.os.Parcelable;

import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by itchenqi on 2018/3/31 0031.
 * description：物业缴费项目中的优惠券信息内容
 */
public class CouponBean implements Parcelable {

    /**
     * 优惠券的id内容
     */
    private String couponId;

    /**
     * 用户的个人id信息
     */
    private String customerId;

    /**
     * 界面使用这个这个字段的优惠券id
     */
    private String couponCustomerId;


    /**
     * 优惠券金额-就是优惠的金额内容
     */
    private BigDecimal couponAmount;

    /**
     * 最低使用金额
     */
    private BigDecimal couponLowAmount;

    /**
     * 优惠券名称 ：满11元减掉10元
     */
    private String couponName;


    //2018年04月17日添加优惠券的剩余的实体内容
    //============================================

    /**
     * 公司名称
     */
    private String companyId;

    /**
     * 优惠券的code
     */
    private String couponCode;
    /**
     * 优惠券的图片内容,应该是背后的齿轮图片
     */
    private String couponImage;

    /**
     * 类型
     */
    private String couponStatus;

    /**
     * 时间内容
     */
    private Date beginTime;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 可用结束时间
     */
    private Date endTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 使用状态（0未使用，1已使用）
     */
    private int useStatus;

    /**
     * 优惠券分类类型 1是商品团购类 2是物业缴费类 3是家装团购类
     */
    private int couponType;

    /**
     * 优惠券的描述内容：商品类优惠券
     */
    private String couponTypeInfo;

    /**
     * 优惠金额信息内容：2019年09月10日变成了优惠券的详细信息
     */
    private String couponInfo;

    /**
     * 优惠券的详细信息
     */
    private String couponDetail;

    /**
     * 描述信息：满11元可用
     */
    private String couponLowAmountInfo;

    /**
     * 还差多少元的优惠描述
     */
    private BigDecimal differenceAmount;

    /**
     * 差4.20元可用该券
     */
    private String differenceInfo;

    //结算页优惠券列表：isMakeUpBill  0:不可凑单;1:可凑单
    private int isMakeUpBill;

    /**
     * 是否是可用的优惠券
     */
    private int isUsableOrDisable;

    /**
     * 是否是 使用记录 的标识 1就是使用记录列表内容，0就不是使用记录列表内容
     */
    private int isUsageRecord;


    //------------------------------------------------


    public String getCouponDetail() {
        return couponDetail;
    }

    public void setCouponDetail(String couponDetail) {
        this.couponDetail = couponDetail;
    }

    public int getIsUsageRecord() {
        return isUsageRecord;
    }

    public void setIsUsageRecord(int isUsageRecord) {
        this.isUsageRecord = isUsageRecord;
    }

    public int getIsUsableOrDisable() {
        return isUsableOrDisable;
    }

    public void setIsUsableOrDisable(int isUsableOrDisable) {
        this.isUsableOrDisable = isUsableOrDisable;
    }

    public int getIsMakeUpBill() {
        return isMakeUpBill;
    }

    public void setIsMakeUpBill(int isMakeUpBill) {
        this.isMakeUpBill = isMakeUpBill;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    private boolean isChecked = false;//默认的都是false的


    public String getCouponLowAmountInfo() {
        return couponLowAmountInfo;
    }

    public void setCouponLowAmountInfo(String couponLowAmountInfo) {
        this.couponLowAmountInfo = couponLowAmountInfo;
    }

    public String getCouponTypeInfo() {
        return couponTypeInfo;
    }

    public void setCouponTypeInfo(String couponTypeInfo) {
        this.couponTypeInfo = couponTypeInfo;
    }

    public BigDecimal getDifferenceAmount() {
        return differenceAmount;
    }

    public void setDifferenceAmount(BigDecimal differenceAmount) {
        this.differenceAmount = differenceAmount;
    }

    public String getDifferenceInfo() {
        return differenceInfo;
    }

    public void setDifferenceInfo(String differenceInfo) {
        this.differenceInfo = differenceInfo;
    }

    /**
     * 存放当前被选中的优惠券内容做勾选记忆功能
     */
    // private HashMap<String, CouponBean> checkedMap;

    /*public HashMap<String, CouponBean> getCheckedMap() {//直接记忆当前对象
        return checkedMap;
    }

    public void setCheckedMap(HashMap<String, CouponBean> checkedMap) {
        this.checkedMap = checkedMap;
    }*/
    public boolean isChecked() {

        //getCheckedMap().put("key", this);//存入的就是当前的这个对象。

        return isChecked;
    }

    public void setChecked(boolean checked) {

        //getCheckedMap().put("key", null);

        isChecked = checked;
    }

    public String getCouponInfo() {
        return couponInfo;
    }

    public void setCouponInfo(String couponInfo) {
        this.couponInfo = couponInfo;
    }

    public int getCouponType() {
        return couponType;
    }

    public void setCouponType(int couponType) {
        this.couponType = couponType;
    }

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public String getCouponCode() {
        return couponCode;
    }

    public void setCouponCode(String couponCode) {
        this.couponCode = couponCode;
    }

    public String getCouponImage() {
        return couponImage;
    }

    public void setCouponImage(String couponImage) {
        this.couponImage = couponImage;
    }

    public String getCouponStatus() {
        return couponStatus;
    }

    public void setCouponStatus(String couponStatus) {
        this.couponStatus = couponStatus;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public int getUseStatus() {
        return useStatus;
    }

    public void setUseStatus(int useStatus) {
        this.useStatus = useStatus;
    }

    public String getCouponCustomerId() {
        return couponCustomerId;
    }

    public void setCouponCustomerId(String couponCustomerId) {
        this.couponCustomerId = couponCustomerId;
    }

    public String getCouponId() {
        return couponId;
    }

    public void setCouponId(String couponId) {
        this.couponId = couponId;
    }

    public Date getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }

    public BigDecimal getCouponAmount() {
        return couponAmount;
    }

    public void setCouponAmount(BigDecimal couponAmount) {
        this.couponAmount = couponAmount;
    }

    public BigDecimal getCouponLowAmount() {
        return couponLowAmount;
    }

    public void setCouponLowAmount(BigDecimal couponLowAmount) {
        this.couponLowAmount = couponLowAmount;
    }

    public String getCouponName() {
        return couponName;
    }

    public void setCouponName(String couponName) {
        this.couponName = couponName;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.couponId);
        dest.writeString(this.customerId);
        dest.writeString(this.couponCustomerId);
        dest.writeSerializable(this.couponAmount);
        dest.writeSerializable(this.couponLowAmount);
        dest.writeString(this.couponName);
        dest.writeString(this.companyId);
        dest.writeString(this.couponCode);
        dest.writeString(this.couponImage);
        dest.writeString(this.couponStatus);
        dest.writeLong(this.beginTime != null ? this.beginTime.getTime() : -1);
        dest.writeLong(this.createTime != null ? this.createTime.getTime() : -1);
        dest.writeLong(this.endTime != null ? this.endTime.getTime() : -1);
        dest.writeLong(this.updateTime != null ? this.updateTime.getTime() : -1);
        dest.writeInt(this.useStatus);
        dest.writeInt(this.couponType);
        dest.writeString(this.couponTypeInfo);
        dest.writeString(this.couponInfo);
        dest.writeString(this.couponDetail);
        dest.writeString(this.couponLowAmountInfo);
        dest.writeSerializable(this.differenceAmount);
        dest.writeString(this.differenceInfo);
        dest.writeInt(this.isMakeUpBill);
        dest.writeInt(this.isUsableOrDisable);
        dest.writeInt(this.isUsageRecord);
        dest.writeByte(this.isChecked ? (byte) 1 : (byte) 0);
    }

    public CouponBean() {
    }

    protected CouponBean(Parcel in) {
        this.couponId = in.readString();
        this.customerId = in.readString();
        this.couponCustomerId = in.readString();
        this.couponAmount = (BigDecimal) in.readSerializable();
        this.couponLowAmount = (BigDecimal) in.readSerializable();
        this.couponName = in.readString();
        this.companyId = in.readString();
        this.couponCode = in.readString();
        this.couponImage = in.readString();
        this.couponStatus = in.readString();
        long tmpBeginTime = in.readLong();
        this.beginTime = tmpBeginTime == -1 ? null : new Date(tmpBeginTime);
        long tmpCreateTime = in.readLong();
        this.createTime = tmpCreateTime == -1 ? null : new Date(tmpCreateTime);
        long tmpEndTime = in.readLong();
        this.endTime = tmpEndTime == -1 ? null : new Date(tmpEndTime);
        long tmpUpdateTime = in.readLong();
        this.updateTime = tmpUpdateTime == -1 ? null : new Date(tmpUpdateTime);
        this.useStatus = in.readInt();
        this.couponType = in.readInt();
        this.couponTypeInfo = in.readString();
        this.couponInfo = in.readString();
        this.couponDetail = in.readString();
        this.couponLowAmountInfo = in.readString();
        this.differenceAmount = (BigDecimal) in.readSerializable();
        this.differenceInfo = in.readString();
        this.isMakeUpBill = in.readInt();
        this.isUsableOrDisable = in.readInt();
        this.isUsageRecord = in.readInt();
        this.isChecked = in.readByte() != 0;
    }

    public static final Creator<CouponBean> CREATOR = new Creator<CouponBean>() {
        @Override
        public CouponBean createFromParcel(Parcel source) {
            return new CouponBean(source);
        }

        @Override
        public CouponBean[] newArray(int size) {
            return new CouponBean[size];
        }
    };
}
